import Mock from 'mockjs'

const list = Mock.mock({
  'list|10': [{
    'appId': '@id',
    'appName': '@cword(3, 5)',
    'childrens|1-5': [
      {
        'appId': '@id',
        'appName': '@cword(3, 5)',
        'childrens|10': [
          {
            'appId': '@id',
            'appName': '@cword(3, 5)',
            'craftList|1-5': [
              {
                'craftId': '@id',
                'createTime': '@now()',
                'createUserId': '@id()',
                'isValid': '',
                'remark': '@cparagraph(1)',
                'taskModelId': '@guid()',
                'updateTime': '@now()',
                'updateUserId': '@guid'
              }
            ],
            'manualList': [
              {
                'remark': '@cparagraph(1)',
                'taskModelId': '@guid()',
                'taskModelManualId': '@guid',
                'workManualId': '@guid()'
              }
            ],
            'modelLevel|+1': 0,
            'nodeList|1-5': [
              {
                'createTime': '@now()',
                'createUserId': '@id',
                'isValid': '',
                'nodeId': '@guid',
                'nodeLev|+1': 0,
                'nodeName': '@cword(3, 5)',
                'nodeSort|+1': 0,
                'price|1-100': 1,
                'remark': '@cword(3, 5)',
                'taskModelId': '@id',
                'unit|1': ['时', '分', '秒'],
                'updateTime': '@now',
                'updateUserId': '@id',
                'workHour|1-100': 1
              }
            ],
            'orgId': '@id',
            'parentId': '@guid',
            'price|1-10': 1,
            'remark': '@cword(3, 5)',
            'sort|+1': 0,
            'taskModelId': '@id',
            'taskModelLabel': '',
            'taskModelName': '@cword(3, 5)',
            'unit|1': ['时', '分'],
            'workHour|1-100': 1
          }
        ],
        'craftList|1-5': [
          {
            'craftId': '@id',
            'createTime': '@now()',
            'createUserId': '@id()',
            'isValid': '',
            'remark': '@cparagraph(1)',
            'taskModelId': '@guid()',
            'updateTime': '@now()',
            'updateUserId': '@guid'
          }
        ],
        'manualList': [
          {
            'remark': '@cparagraph(1)',
            'taskModelId': '@guid()',
            'taskModelManualId': '@guid',
            'workManualId': '@guid()'
          }
        ],
        'modelLevel|+1': 0,
        'nodeList|1-5': [
          {
            'createTime': '@now()',
            'createUserId': '@id',
            'isValid': '',
            'nodeId': '@guid',
            'nodeLev|+1': 0,
            'nodeName': '@cword(3, 5)',
            'nodeSort|+1': 0,
            'price|1-100': 1,
            'remark': '@cword(3, 5)',
            'taskModelId': '@id',
            'unit|1': ['时', '分', '秒'],
            'updateTime': '@now',
            'updateUserId': '@id',
            'workHour|1-100': 1
          }
        ],
        'orgId': '@id',
        'parentId': '@guid',
        'price|1-10': 1,
        'remark': '@cword(3, 5)',
        'sort|+1': 0,
        'taskModelId': '@id',
        'taskModelLabel': '',
        'taskModelName': '@cword(3, 5)',
        'unit|1': ['时', '分'],
        'workHour|1-100': 1
      }
    ],
    'craftList': [
      {
        'craftId': '@id',
        'createTime': '@now',
        'createUserId': '@id',
        'isValid': '',
        'remark': '@cword(3, 5)',
        'taskModelId': '@id',
        'updateTime': '@now',
        'updateUserId': '@id'
      }
    ],
    'manualList': [
      {
        'remark': '@cword(3, 5)',
        'taskModelId': '@id',
        'taskModelManualId': '@id',
        'workManualId': '@id'
      }
    ],
    'modelLevel|+1': 0,
    'nodeList': [
      {
        'createTime': '@now',
        'createUserId': '@id',
        'isValid': '',
        'nodeId': '@id',
        'nodeLev|+1': 0,
        'nodeName': '@name',
        'nodeSort|+1': 0,
        'price|1-100': 1,
        'remark': '@cword(3, 5)',
        'taskModelId': '@id',
        'unit|1': ['时分', '秒'],
        'updateTime': '@now',
        'updateUserId': '@id',
        'workHour': 12
      }
    ],
    'orgId': '@id',
    'parentId': '@id',
    'price|1-100': 1,
    'remark': '@cword(3, 5)',
    'sort|+1': 0,
    'taskModelId': '@id',
    'taskModelLabel': '@cword(3, 5)',
    'taskModelName': '@cword(3, 5)',
    'unit|1': ['时分', '秒'],
    'workHour|1-100': 2
  }]

})
const pub = {
  isMore: 0,
  pageIndex: 1,
  pageSize: 10,
  startIndex: 0,
  totalNum: 30,
  totalPage: 1
}
const dictMap = {}
export default [
  // 新增任务模板
  {
    url: '/task/taskModel/addTaskModel',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {},
        msg: ''
      }
    }
  },
  // 根据ID删除任务模板
  {
    url: '/task/taskModel/deleteTaskModelById',
    type: 'get',
    response: config => {
      return {
        code: 1,
        data: {},
        msg: ''
      }
    }
  },
  //   标签查询
  {
    url: '/task/taskModel/labelSearch',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {
          ...list,
          ...pub
        },
        msg: ''
      }
    }
  },
  //  查询任务模板
  {
    url: '/task/taskModel/listAllTaskModel',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {
          ...list
        },
        msg: ''
      }
    }
  },
  //   分页查询任务模板
  {
    url: '/task/taskModel/listTaskModelByPage',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {
          ...list,
          ...pub
        },
        dictMap,
        msg: ''
      }
    }
  },
  //   修改任务模板
  {
    url: '/task/taskModel/modifyTaskModel',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {
          ...list,
          ...pub
        },
        msg: ''
      }
    }
  },
  //   树形结构展示任务模板【APP、网页共用】
  {
    url: '/task/taskModel/treeTaskModel',
    type: 'get',
    response: config => {
      return {
        code: 1,
        data: [...list.list],
        msg: ''
      }
    }
  },
  //   查看任务模板
  {
    url: '/task/taskModel/viewTaskModelById',
    type: 'get',
    response: config => {
      return {
        code: 1,
        data: {
          ...list.list[0]
        },
        msg: ''
      }
    }
  }
]
